package tr3dtris.game.controller.inputMapper;

import tr3dtris.game.GameActions;
import tr3dtris.game.IGameActions;

/**
 * Abstract class used to implements to implements object used to map user input
 * and call the connected game actions.
 * @author Luciano Mammino <loige@hotmail.com>
 * @author Andrea Mangano <kapitan0@hotmail.it>
 * @version 0.1
 * @since 0.1
 */
public abstract class AbstractInputMapper implements IInputMapper, IGameActions
{

    /**
     * Reference to the connected <GameActions> instance
     */
    private GameActions gameActions;

    /**
     * Constructor. Creates a new AbstractInputMapper for a given <GameActions>
     * instance.
     * @param gameActions
     */
    public AbstractInputMapper(GameActions gameActions)
    {
        this.gameActions = gameActions;
    }

    /**
     * {@inheritDoc}
     */
    public void start() {
        this.getGameActions().start();
    }

    /**
     * {@inheritDoc}
     */
    public void pause() {
        this.getGameActions().pause();
    }

    /**
     * {@inheritDoc}
     */
    public void restart() {
        this.getGameActions().restart();
    }

    /**
     * {@inheritDoc}
     */
    public void moveCurrentPieceDown() {
        this.getGameActions().moveCurrentPieceDown();
    }

    /**
     * {@inheritDoc}
     */
    public void moveCurrentPieceLeft() {
        this.getGameActions().moveCurrentPieceLeft();
    }

    /**
     * {@inheritDoc}
     */
    public void moveCurrentPieceRight() {
        this.getGameActions().moveCurrentPieceRight();
    }

    /**
     * {@inheritDoc}
     */
    public void moveCurrentPieceUp() {
        this.getGameActions().moveCurrentPieceUp();
    }

    /**
     * {@inheritDoc}
     */
    public void cwRotateCurrentPiece() {
        this.getGameActions().cwRotateCurrentPiece();
    }

    /**
     * {@inheritDoc}
     */
    public void ccwRotateCurrentPiece() {
        this.getGameActions().ccwRotateCurrentPiece();
    }

    /**
     * {@inheritDoc}
     */
    public void dropCurrentPiece() {
        this.getGameActions().dropCurrentPiece();
    }

    /**
     * @return the gameActions
     */
    public GameActions getGameActions() {
        return gameActions;
    }


}
